package lookas.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Calendar;

public class Transaction implements Serializable {

    private static final long serialVersionUID = -1256880030628424482L;

    private int               id;

    private Calendar          pricedate;

    private BigDecimal        amount;

    private byte              sign;

    private Customer          customer;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Calendar getPricedate() {
        return pricedate;
    }

    public void setPricedate(Calendar pricedate) {
        this.pricedate = pricedate;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public byte getSign() {
        return sign;
    }

    public void setSign(byte sign) {
        this.sign = sign;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    @Override
    public int hashCode() {
        return this.getId();
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Transaction)) {
            return false;
        }
        Transaction other = (Transaction) object;
        int o1 = this.getId();
        int o2 = other.getId();
        return o1 == o2;
    }

    @Override
    public String toString() {
        return customer + ": " + id;
    }
}
